import Vue from 'vue'
import Router from 'vue-router'
// import HelloWorld from '@/components/HelloWorld'
import Login from '@/components/login/Login'
// import Index from '@/components/product/index'
import Home from '@/components/product/components/home.vue'

Vue.use(Router)

export default new Router({
  mode:"hash",//abstract
  routes: [
    {
      path: '/',
      redirect: "/product/index"
    },
    {
      path: '/login',
      name: 'Login',
      component: Login
    },
    {
      path: '/product/index',
      name: 'Index',
      component: ()=> import('@/components/product/index'),
      meta:{
        title : "首页",
        requireAuth:true
      },
      children:[
        {
          path: '/',
          name: 'home',
          component: Home,
          meta:{
            title : "首页",
            requireAuth:true
          },
        },
        {
          path: '/user/index',
          name: 'user',
          component: ()=> import('@/components/user/index'),
          meta:{
            title : "用户模块",
            requireAuth:true
          },
        },
        {
          
          path: '/news/index',
          name: 'news',
          component: ()=> import('@/components/news/index'),
          meta:{
            title : "新闻模块",
          }
        },
        {
          path: '/product/index',
          name: 'product',
          component: ()=> import('@/components/product/product'),
          meta:{
            title : "商品模块",
            requireAuth:true
          },
        },
        {
          path: '/order/index',
          name: 'order',
          component: ()=> import('@/components/order/index'),
          meta:{
            title : "订单模块",

            requireAuth:true
          },
        },

      ]
    },
  ]
})
